#region Using directives

using System;
using System.Collections.Generic;
using System.Text;
using IGIS.DAL;
using System.Data;

#endregion

namespace IGIS.BOL
{
    public class Contacts
    {
        private int intfldID;
        private string strFNAME;
        private string strLNAME;
        private string strLname;
        private string strAddress;
        private string strCity;
        private string strEmail;
        private string strPH1;
        private string strPH2;
        private string strCOMMENTS;
        private string strContactType;
        private int intLayoutID;

        public int fldID
        {
            get
            {
                return intfldID;
            }
            set
            {
                intfldID = value;
            }
        }
        public string Fname
        {
            get
            {
                return strFNAME;
            }
            set
            {
                strFNAME = value;
            }
        }
        public string Lname
        {
            get
            {
                return strLNAME;
            }
            set
            {
                strLNAME = value;
            }
        }
        public string Address
        {
            get
            {
                return strAddress;
            }
            set
            {
                strAddress = value;
            }
        }
        public string City
        {
            get
            {
                return strCity;
            }
            set
            {
                strCity = value;
            }
        }
        public string Email
        {
            get
            {
                return strEmail;
            }
            set
            {
                strEmail = value;
            }
        }
        public string PH1
        {
            get
            {
                return strPH1;
            }
            set
            {
                strPH1 = value;
            }
        }
        public string PH2
        {
            get
            {
                return strPH2;
            }
            set
            {
                strPH2 = value;
            }
        }
        public string COMMENTS
        {
            get
            {
                return strCOMMENTS;
            }
            set
            {
                strCOMMENTS = value;
            }
        }
        public string ContactType
        {
            get
            {
                return strContactType;
            }
            set
            {
                strContactType = value;
            }
        }
        public int LayoutID
        {
            get
            {
                return intLayoutID;
            }
            set
            {
                intLayoutID = value;
            }
        }

        public static DataSet GetContacts(string contactype, string lid)
        {
            DBSQLExpress db = new DBSQLExpress();
            db.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ContactType", contactype));
            db.Parameters.Add(new System.Data.SqlClient.SqlParameter("@LayoutID", lid));
            return db.ExecuteDataSet("BetolamDb_Contacts_SelectByType");
        }

        public static DataSet GetContactTypes()
        {
            DBSQLExpress db = new DBSQLExpress();
            return db.ExecuteDataSet("BetolamDb_ContactTypes_SelectAll");
        }

        public static int InsertStatus(Contacts c)
        {
            DBSQLExpress db = new DBSQLExpress();
            db.AddParameter("@sFNAME", c.Fname);
            db.AddParameter("@sLNAME", c.Lname);
            db.AddParameter("@sAddress", c.Address);
            db.AddParameter("@sCity", c.City);
            db.AddParameter("@sEmail", c.Email);
            db.AddParameter("@sPH1", c.PH1);
            db.AddParameter("@sPH2", c.PH2);
            db.AddParameter("@sCOMMENTS", c.COMMENTS);
            db.AddParameter("@sContactType", c.ContactType);
            db.AddParameter("@iUID", c.fldID);
            int rtn = db.ExecuteNonQuery("Betolam_Contacts_Insert");
            return rtn;
        }

        public static void InsertContactWithKeverID(int LUID, int KeverID, string ContactType)
        {
            DBSQLExpress db = new DBSQLExpress();
            db.AddParameter("@iKeverID", KeverID);
            db.AddParameter("@iUID", LUID);
            db.AddParameter("@sContactType", ContactType);
            int rtn = db.ExecuteNonQuery("Betolam_Contacts_Insert");
        }

        public static void UpdateContact(Contacts c)
        {
            DBSQLExpress db = new DBSQLExpress();
            db.AddParameter("@fldID", c.fldID);
            db.AddParameter("@FNAME", c.Fname);
            db.AddParameter("@LNAME", c.Lname);
            db.AddParameter("@Address", c.Address);
            db.AddParameter("@City", c.City);
            db.AddParameter("@Email", c.Email);
            db.AddParameter("@PH1", c.PH1);
            db.AddParameter("@PH2", c.PH2);
            db.AddParameter("@COMMENTS", c.COMMENTS);

            db.ExecuteNonQuery("Betolam_Contacts_Update");
            
        }
    }


}
